#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>

 int main()
 {
    pid_t pid = fork();
    if(pid==0)
    {
        execlp("/bin/ls", "ls", "-l", NULL);
        printf("exec failed\n");
        return 1;
    }
    else if(pid>0)
    {
       
        sleep(5);
        printf("i am parent process\n");
        waitpid(pid, NULL, 0);
        printf("child process finished\n");
    }
    else
    {
        printf("fork failed\n");
        return 1;
    }
 }